package StudyCode.summary.mycollection;

import java.util.Vector;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class SearchAnElementOfVector {
	public static void main(String[] args) {
		Vector v = new Vector();
		v.add("1");
		v.add("2");
		v.add("3");
		v.add("4");
		v.add("5");
		v.add("1");
		v.add("2");

		boolean blnFound = v.contains("3");
		System.out.println("Vector 是否包含 3 ? " + blnFound);

		int index = v.indexOf("5");
		if (index == -1)
			System.out.println("Vector 不包含 5");
		else
			System.out.println("Vector 包含 5 索引是 :" + index);

		int lastIndex = v.lastIndexOf("2");
		if (lastIndex == -1)
			System.out.println("Vector 不包含 2");
		else
			System.out.println("Vector 包含 2 索引是 :" + lastIndex);

	}
}
